/*
 * eyes.h
 *
 *  Created on: Nov 26, 2012
 *      Author: Michiel Hegemans
 */

#ifndef EYES_EMOTION_H_
#define EYES_EMOTION_H_

#include "emotion/emotion_handler.h"
#include "comm/eyes_msg.h"
#include "std_msgs/Float64.h"

class EyesHandler : public EmotionHandler {
private:
	ros::Publisher	_eyes_left_pub;
	ros::Publisher	_eyes_right_pub;
	ros::Publisher	_eyes_pitch_pub;

	ros::Subscriber _eyes_left_sub;
	ros::Subscriber	_eyes_right_sub;
	ros::Subscriber _eyes_pitch_sub;

	comm::eyes		_eyes_state;

	bool			_message_sent;
	int				_prev_state;
protected:
	void leftEyeCallback(const std_msgs::Float64::ConstPtr &msg);
	void rightEyeCallback(const std_msgs::Float64::ConstPtr &msg);
	void pitchEyeCallback(const std_msgs::Float64::ConstPtr &msg);
public:
	EyesHandler();
	~EyesHandler();

	void init();
	void spin();

	void processEmotion();
	void setEyesState(int state);
	void setEyesPitchYaw(float pitch, float yaw);
	void playEmotion();
};

#endif /* EYES_EMOTION_H_ */
